package COMP;

import java.awt.BasicStroke;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JPanel;

public class DrawCube extends JPanel{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	int[] xpos;
	int[] ypos;
	DrawCube(int[] xpos, int[] ypos){
		this.xpos = xpos;
		this.ypos = ypos;
		this.setSize(550,400);
		this.setOpaque(false);
	}
	public void paint(Graphics g){
		Graphics2D g2d = (Graphics2D)g.create();
		float[] dash=new float[]{10,5,5,5};
	    g2d.setStroke(new BasicStroke(1,0,BasicStroke.JOIN_MITER,1.0f,dash, 0));
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		g2d.drawLine(xpos[0], ypos[0], xpos[1], ypos[1]);
		g2d.drawLine(xpos[0], ypos[0], xpos[3], ypos[3]);
		g2d.drawLine(xpos[0], ypos[0], xpos[4], ypos[4]);
		g2d.drawLine(xpos[1], ypos[1], xpos[2], ypos[2]);
		g2d.drawLine(xpos[1], ypos[1], xpos[5], ypos[5]);
		g2d.drawLine(xpos[2], ypos[2], xpos[3], ypos[3]);
		g2d.drawLine(xpos[2], ypos[2], xpos[6], ypos[6]);
		g2d.drawLine(xpos[3], ypos[3], xpos[7], ypos[7]);
		g2d.drawLine(xpos[4], ypos[4], xpos[5], ypos[5]);
		g2d.drawLine(xpos[4], ypos[4], xpos[7], ypos[7]);
	}
}
